﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using System.Configuration;

namespace whatpricemyhouse
{
    public class SendEmail
    {
        public  SendEmail(String from, String to, String subject,String body)
        {
            System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
            msg.To.Add(to);

            msg.From = new MailAddress(from, "How much price my house", System.Text.Encoding.UTF8);

            msg.Subject = subject; 
            msg.SubjectEncoding = System.Text.Encoding.UTF8;
            msg.Body = body; 
            msg.BodyEncoding = System.Text.Encoding.UTF8; 
            msg.IsBodyHtml = true; 
            msg.Priority = MailPriority.High; 

            SmtpClient client = new SmtpClient();

            object userState = msg;
            try
            {
                client.Send(msg);
            }
            catch (System.Net.Mail.SmtpException ex)
            {
                //client.SendAsyncCancel();
            }
        }
    }
}